/*DCb6ykaxaAd4W8nmS8F2ajdH5V7UkH/Q+ip6CB5XiB1hBenhNLeVWLDrN2L2bUac*/
/*
 * @Author: xiahui 
 * @PageInfo: 终止 
 * @Date: 2019-01-18 14:44:52 
 * @Last Modified by: xiahui
 * @Last Modified time: 2019-07-10 15:52:45
 */
import { AREA, URL, FIELDS } from '../../constance';
import { listBaseScriptAction, showListScriptActionDlg, isShowScriptActionDlg } from '../../utils/baseScriptUtil';
import { showWarningDialog } from '../../../../../scmpub/scmpub/pub/tool/messageUtil';
import { getLangByResId } from '../../../../../scmpub/scmpub/pub/tool/multiLangUtil';

export default function(props, record, index) {
	showWarningDialog(getLangByResId(this, '4004PURDAILY-000011'), getLangByResId(this, '4004PURDAILY-000012'), {
		/* 国际化处理： 确认终止,是否确定将此合同终止*/
		beSureBtnClick: () => {
			let billDate;
			if (record && index >= 0) {
				if (record[FIELDS.invallidate]) {
					billDate = record[FIELDS.invallidate].value;
				}
			} else {
				let invallidate = props.table.getCheckedRows(AREA.listTableId)[0].data.values[FIELDS.invallidate];
				if (invallidate) {
					billDate = props.table.getCheckedRows(AREA.listTableId)[0].data.values[FIELDS.invallidate].value;
				}
			}

			if (billDate && isShowScriptActionDlg(billDate)) {
				showListScriptActionDlg.call(
					this,
					props,
					URL.end,
					getLangByResId(this, '4004PURDAILY-000013'),
					record,
					index,
					getLangByResId(this, '4004PURDAILY-000014')
				); /* 国际化处理： 终止成功,实际终止日期与计划终止日期不符，请输入原因*/
			} else {
				listBaseScriptAction.call(
					this,
					props,
					URL.end,
					getLangByResId(this, '4004PURDAILY-000013'),
					record,
					index
				); /* 国际化处理： 终止成功*/
			}
		}
	});
}

/*DCb6ykaxaAd4W8nmS8F2ajdH5V7UkH/Q+ip6CB5XiB1hBenhNLeVWLDrN2L2bUac*/